package com.bodystm.temperature.bed;

import java.util.List;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.mimosa.common.dao.HibernateDao;


@Repository
public class BedDao extends HibernateDao<Bed, String> {
	
	public Bed getBedByName(String bedName,String userId){
		logger.info(bedName);
		if(bedName.length()==0) return null;
		Session session = super.getSession();
		String sql="select * from t_bed where name='"+bedName+"' and user_id='"+userId+"'";
		List<Bed> list=session.createSQLQuery(sql).addEntity(Bed.class).list();
		if(list==null&&list.size()<=0){
			return null;
		}else{
			return list.get(0);
		}
		
	}
}